import { PASS_HANDLE_LIST} from "./actionsTypes";
import handleListService from  '../services/handleListService';
import { Toast } from 'antd-mobile'

export const getHandleList=(data,callBack)=>{
	return (dispatch, getState)=> {
		Toast.hide();
		Toast.loading("", 30, () => Toast.info("网络错误", 2));
		handleListService.getHandleList(data).then(resultData => {
			Toast.hide();
			if (resultData.code == 1000) {
				callBack(resultData.body.endorseOrderMsgList)
			} else {
				Toast.info(resultData.msg);
			}
		});
	}
}

export const deleteHandle=(data,callBack)=>{
	return (dispatch, getState)=> {
		Toast.hide();
		Toast.loading("", 30, () => Toast.info("网络错误", 2));
		handleListService.deleteHandle(data).then(resultData => {
			Toast.hide();
			if (resultData.code == 1000) {
				Toast.info('删除成功',1)
				callBack(true)
			} else {
				Toast.info(resultData.msg);
			}
		});
	}
}